<template>
  <div class="examinReport-content">
          <div class="examinReportBox">
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">清洁记录</div>
                </div>

                <div class="header-search">
 
                         <div class="searchBox">
                          <div class="lable">清洁时间</div>
                                <el-date-picker
                              v-model="planComplete"
                              clearable
                              type="daterange"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              range-separator="至"
                              start-placeholder="开始日期"
                              end-placeholder="结束日期">
                            </el-date-picker>
                        </div>
                        <div class="searchBox">
                             <el-button class="search-btn" type="primary" icon="" size="" @click="handleQuery">搜索</el-button>
                             <el-button class="search-btn" icon="" size="" @click="resetQuery">重置</el-button>
                        </div>
                </div>

                <el-table :data="infoList" border>
                  <el-table-column label="序号" align="center" type="index" />
                  <el-table-column label="清洁时间" align="center" prop="cleanTime" />
                  <el-table-column label="操作" align="center" >
                        <template slot-scope="scope">
                                <el-button
                                size="mini"
                                type="text"
                                @click="handleTest(scope.row)"
                                >查看详情</el-button>
                        </template>
                    </el-table-column > 
                </el-table>
                 <pagination
                  v-show="total>10"
                  :total="total"
                  :page.sync="queryParams.pageNum"
                  :limit.sync="queryParams.pageSize"
                  @pagination="getConcentrateWaterFn"
                  />
                <div class="bottomBtnCss">
                  <el-button @click="goBackBtn">返回</el-button>
                 </div>
          </div>
  </div>
</template>

<script>
  import { getConcentrateWater} from "@/api/zhangping/watherDrinking";
  export default {
    data() {
      return {
         type:'',
         infoList:[],
          queryParams: {  
              beginCleanTime:'', // 开始时间
              endCleanTime:'',  // 结束时间
              creditCode:'', 
              pageNum: 1,
              pageSize: 10,
          },
          planComplete:'',
          total:0,
      };
    },
    created() {
         this.queryParams.creditCode = this.$route.query.creditCode
         this.getConcentrateWaterFn()
    },
    methods: {
         getConcentrateWaterFn(){
         if(this.planComplete !=null && this.planComplete != undefined){
              if(this.planComplete.length > 0){
                    this.queryParams.beginCleanTime = this.planComplete[0]
                    this.queryParams.endCleanTime = this.planComplete[1]
              }    
          }else{
               this.queryParams.beginCleanTime = ''
               this.queryParams.endCleanTime = ''
          }  
         getConcentrateWater(this.queryParams).then(res=>{
                if(res.code == 200){
                     this.infoList = res.rows
                     this.total = res.total
                }else{
                     this.$message.error(res.msg);  
                }    
         })
     },
     reset() {
      this.queryParams = {
          beginCleanTime:'', // 开始时间
          endCleanTime:'',  // 结束时间
          pageNum: 1,
          pageSize: 10,
      };
      this.planComplete = ''
    },
     handleQuery(){
        this.queryParams.pageNum = 1;
        this.getConcentrateWaterFn()
    },
    resetQuery(){
           this.reset()
    },
    handleTest(item){
      this.$store.commit('drinkingWater/CLEAN_DETAIL_KEY',item)
      this.$router.push(`/drinkWaterHygiene/test/cleanDetails?waterCleanId=${item.id}`)  
    },

        goBackBtn(){
          this.$router.back()
        },
    }
  };
</script>
<style lang="scss" scoped>
         .display-fx-center{
             display: flex;
             align-items: center;
         }
         .per100{
             width: 100%!important;
         }
         .soildTop{
             border-top:solid 1px  #D3D8E2;
         }
         .examinReport-content{
              overflow-y: auto;
              position: relative;
              background-color: #fff;
              padding: 40px 20px;
              border-radius: 10px;
              height: calc( 100vh - 66px - 40px);
             .examinReportBox{
                    padding-bottom:40px;
              }
           .headerBox{
                font-size: 16px;
                color: #484848;
                font-weight: bold;
                // margin-top:40px;/
                margin-bottom:15px;
                @extend .display-fx-center;
                .line{
                  width: 4px;
                  height: 12px;
                  background: #5D85FF;
                  border-radius: 6px 6px 6px 6px;
                  margin-right:6px;
                }
             }
             .header-search{
                   flex-wrap: wrap;
                   @extend .display-fx-center; 
                  .searchBox{
                    font-size: 14px;
                    color: #797C84;
                     margin-right:40px;
                      margin-bottom:15px; 
                      @extend .display-fx-center; 
                      .lable{
                           flex-shrink: 0;
                           margin-right:10px; 
                      } 
                      .search-btn{
                        padding: 8px 20px!important;
                      }
                  }
             }
          }
          .bottomBtnCss{
            // margin-top: auto;
            text-align: right;
            position: fixed;
            bottom: 40px;
            right: 40px; 
        }
        .preview{
              @extend .display-fx-center;  
              justify-content: center; 
        }
        .pagination{
              @extend .display-fx-center;  
              justify-content: center;   
              margin-top:50px;     
        }
        ::v-deep{  
           .el-table__header-wrapper th{
                 background: #F4F8FF!important;       
           }
            .el-image,.el-image__inner{
               width: 80px!important;
               height: 30px!important;
            }
            .header-search{
               .el-input .el-input__inner{
                 height: 32px!important;
                 line-height: 32px!important;
                 width: 240px;
                }
                .el-date-editor{
                    height: 32px!important;
                    line-height: 32px!important;
                }
                .el-range-separator,.el-input__icon{
                    line-height: 24px!important;   
                }
            }     
        }
        
</style>
